﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace Kokomo.Mirror.CliMetadata.Signatures
{
	public class FieldSignature : MemberRefSignature
	{
		internal FieldSignature()
		{
		}

		//public CustomModifier[] customMods;
		public TypeSpec type;

		public override string ToString()
		{
			return "Field: type=" + this.type.ToString();
		}

		public override bool Equals(object obj)
		{
			FieldSignature other = obj as FieldSignature;
			if (other == null) return false;

			return this.type.Equals(other.type);
		}

		public bool Matches(
			FieldInfo field,
			Module module,
			Type[] genericTypeArguments,
			Type[] genericMethodArguments
			)
		{
			if ((object)field == null) throw new ArgumentNullException("field");

			bool matches = type.Matches(field.FieldType, module, genericTypeArguments, genericMethodArguments);
			return matches;
		}
	}
}
